package com.cogent.business.action.base;

import java.util.HashMap;
import java.util.List;

import com.cogent.business.action.AbstractAction;
import com.cogent.common.util.MapUtil;
import com.cogent.common.util.StringUtil;

public class SysUserComAction extends AbstractAction {
	public String gethouse() {
		HashMap formMap = getFormMapWithUser();
		String comId=MapUtil.getStringValue(formMap, "id");
		String sql="select wrname as name,id from wr_house where status=0";
		if(!StringUtil.isEmpty(comId))
			sql+=" and id='" + comId.trim() + "'";
		List list = bussinessFacade.query(sql);
		String message = MapUtil.listMapToJsonStr(list);
		responseMsg(message);
		
		return null;
	}
	public String getsuppiler() {
		HashMap formMap = getFormMapWithUser();
		String comId=MapUtil.getStringValue(formMap, "id");
		String sql="select suppname as name,id from pd_suppiler where status=3";
		if(!StringUtil.isEmpty(comId))
			sql+=" and id='" + comId.trim() + "'";
		List list = bussinessFacade.query(sql);
		String message = MapUtil.listMapToJsonStr(list);
		responseMsg(message);
		
		return null;
	}
	public String getbuyer() {	
		HashMap formMap = getFormMapWithUser();
		String comId=MapUtil.getStringValue(formMap, "id");
		String sql="select companyname as name,id from pd_buyer where status=3";
		if(!StringUtil.isEmpty(comId))
			sql+=" and id='" + comId.trim() + "'";
		List list = bussinessFacade.query(sql);
		String message = MapUtil.listMapToJsonStr(list);
		responseMsg(message);
		
		return null;
	}
	public String getsshCompany() {	
		HashMap formMap = getFormMapWithUser();
		String comId=MapUtil.getStringValue(formMap, "id");
		String sql="select companyname as name,id from shh_company where status=0";
		if(!StringUtil.isEmpty(comId))
			sql+=" and id='" + comId.trim() + "'";
		List list = bussinessFacade.query(sql);
		String message = MapUtil.listMapToJsonStr(list);
		responseMsg(message);
		
		return null;
	}
	
	public String getwlcompany() {		
		HashMap formMap = getFormMapWithUser();
		String comId=MapUtil.getStringValue(formMap, "id");
		String sql="select companyname as name,id from wl_company where status=0";
		if(!StringUtil.isEmpty(comId))
			sql+=" and id='" + comId.trim() + "'";
		List list = bussinessFacade.query(sql);
		String message = MapUtil.listMapToJsonStr(list);
		responseMsg(message);
		
		return null;
	}
	
	public String getsshManfact() {		
		HashMap formMap = getFormMapWithUser();
		String comId=MapUtil.getStringValue(formMap, "id");
		String sql="select manfact as name,id from pd_manufact where status=0";
		if(!StringUtil.isEmpty(comId))
			sql+=" and id='" + comId.trim() + "'";
		List list = bussinessFacade.query(sql);
		String message = MapUtil.listMapToJsonStr(list);
		responseMsg(message);
		
		return null;
	}
}
